package com.bjpowernode.crm.workbench.service.impl;

import com.bjpowernode.crm.commons.Activities;
import com.bjpowernode.crm.workbench.domain.Activity;
import com.bjpowernode.crm.workbench.domain.ActivityRemark;
import com.bjpowernode.crm.workbench.mapper.ActivityMapper;
import com.bjpowernode.crm.workbench.mapper.ActivityRemarkMapper;
import com.bjpowernode.crm.workbench.service.ActivityService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;
import java.util.Map;

/**
 * ClassName: ActivityServiceImpl<br/>
 * Package: com.bjpowernode.crm.workbench.service.impl<br/>
 * Description: <br/>
 * Date: 2022/7/6 14:48<br/>
 * Auther:对的我写的，错的我同事写的<br/>
 */
@Service
public class ActivityServiceImpl implements ActivityService {

    @Resource
    private ActivityMapper activityMapper;
    @Resource
    private ActivityRemarkMapper remarkMapper;
    @Override
    public Activities<Activity> queryActivities(Map requestMap) {
        List<Activity> activityList = activityMapper.queryActivities(requestMap);
        Integer allNumber = activityMapper.queryActivities2(requestMap);
        Activities activities = new Activities();
        activities.setActivityList(activityList);
        activities.setAllCount(allNumber);
        return activities;

    }

    @Override
    public Integer addActivities(Activity activity) {

        return activityMapper.insertSelective(activity);
    }

    @Override
    public Activity queryActivityById(String id) {
        return activityMapper.selectByPrimaryKey(id);
    }

    @Override
    public Integer updateActivityModal(Activity activity) {
        return activityMapper.updateByPrimaryKeySelective(activity);
    }

    @Override
    public Integer deleteActivityBtn(String[] ids) {
        return activityMapper.deleteActivityBtn(ids);
    }

    @Override
    public List<Activity> selectActivities() {
        return activityMapper.selectActivities();
    }

    @Override
    public Integer addActivitiesByList(List<Activity> activityList) {
        return activityMapper.addActivitiesByList(activityList);
    }

    @Override
    public List<Activity> selectActivities(String[] ids) {
        return activityMapper.selectActivitiesbyids(ids);
    }

    @Override
    public Activity queryById(String id) {
        return activityMapper.queryById(id);
    }

    @Override
    public List<ActivityRemark> selectActivityRemark(String activityId) {
        return remarkMapper.selectByPrimaryKeys(activityId);
    }

    @Override
    public Integer insertbeizhu(ActivityRemark remark) {
        return remarkMapper.insertSelective(remark);
    }

    @Override
    public Integer updateactivityRemark(ActivityRemark remark) {
        return remarkMapper.updateByPrimaryKeySelective(remark);
    }

    @Override
    public Integer deleteActivityRemarkById(String id) {
        return remarkMapper.deleteByPrimaryKey(id);
    }
}
